//
//  SwiftyWidgetConfig.swift
//  
//
//  Created by Jason on 2021/8/10.
//

import Foundation
import UIKit




public struct SwiftyWidgetConfig {
    /// 动画持续时间
    let animationDuration:TimeInterval
    /// 默认小窗的位置
    let floatingDefaultPoint:CGPoint
    
    /// 默认小窗的Size
    let floatingDefaultSize:CGSize
    
    /// 浮窗的圆角
    let floatingWindowRadious:CGFloat
    
    /// 浮窗内容边距
    let windowContentEdge:UIEdgeInsets
    
    /// window 背景色
    let windowBackgroundColor:UIColor
    /// window 离屏幕最小间距
    let windowMinimumSpace:CGFloat
    
    public init(animationDuration: TimeInterval, floatingDefaultPoint: CGPoint, floatingDefaultSize: CGSize, floatingWindowRadious: CGFloat, windowContentEdge: UIEdgeInsets, windowBackgroundColor: UIColor ,windowMinimumSpace: CGFloat = 0) {
        
        self.animationDuration = animationDuration
        self.floatingDefaultPoint = floatingDefaultPoint
        self.floatingDefaultSize = floatingDefaultSize
        self.floatingWindowRadious = floatingWindowRadious
        self.windowContentEdge = windowContentEdge
        self.windowBackgroundColor = windowBackgroundColor
        self.windowMinimumSpace = windowMinimumSpace
    }
    
    /// 默认的位置
    var windowDefaultFrame:CGRect{
        return CGRect(origin: floatingDefaultPoint, size: floatingDefaultSize)
    }
}


public extension SwiftyWidgetConfig{
    
    internal(set) static var `default` = SwiftyWidgetConfig(animationDuration: 0.25, floatingDefaultPoint: CGPoint(x: 0, y: 100), floatingDefaultSize: CGSize(width: 78, height: 80), floatingWindowRadious: 14, windowContentEdge: UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8), windowBackgroundColor: #colorLiteral(red: 0.9411764706, green: 0.9411764706, blue: 0.9411764706, alpha: 1))
}
